#!/usr/bin/python

"""
__version__ = "$Revision: 1.7 $"
__date__ = "$Date: 2004/05/05 16:53:25 $"
"""

from PythonCard import model

# KEA 2001-12-11
# if you want to build a standalone executable using py2exe
# then uncomment the import line below
# due to the way the dynamic imports of components work, each
# component that an app uses needs to be imported statically when
# doing a py2exe build
#from PythonCard.components import button, textfield

class Counter(model.Background):

    def on_menuCounterIncrement_select(self, event):
        startValue = int(self.components.field1.text)
        endValue = startValue + 1
        self.components.field1.text = str(endValue)

    def on_menuCounterDecrement_select(self, event):
        startValue = int(self.components.field1.text)
        endValue = startValue - 1
        self.components.field1.text = str(endValue)

    def on_menuCounterReset_select(self, event):
        self.components.field1.text = "0"

    def on_incrBtn_mouseClick(self, event):
        startValue = int(self.components.field1.text)
        endValue = startValue + 1
        self.components.field1.text = str(endValue)

    def on_decrBtn_mouseClick(self, event):
        startValue = int(self.components.field1.text)
        endValue = startValue - 1
        self.components.field1.text = str(endValue)

    def on_resetBtn_mouseClick(self, event):
        self.components.field1.text = "0"

if __name__ == '__main__':
    app = model.Application(Counter)
    app.MainLoop()
